<?php 
class Cart extends Object
{
	public $Items;
	public $CartItems;
	public $CartItemsCount;
	public $Vat;
	
	public $cartNetWeight;
	public $cartGrosWeight;
	public $cartVolume;
	public $cartDimUnit;
	public $cartWeightUnit;
	
	public $AllItemsPrice;
	public $AllItemsVat;
	public $AllItemsTotal;
	
	public $CartImage;
	public $CartImages;
	
	public $SaleStartHour;
	public $SaleEndHour;
	
	public $DisplayDialog;
	
	public function Cart() 
	{
		global $shop;
		$this->cartDimUnit = $shop->getSetting('dim_unit');
		$this->cartWeightUnit = $shop->getSetting('weight_unit');
		$this->cartNetWeight = 0;
		$this->cartGrosWeight = 0;
		$this->cartVolume = 0;
		$this->Vat = 1.25;
		$this->CartItemsCount = 0;
		self::setSaleStartHour(0);
		self::setSaleEndHour(0);
		
		if(!defined('RUN_CRON'))
		{
			$this->Items = self::getItemsArray();
			
			if($_REQUEST['action'] == 'add_to_cart')
			{ 
				self::addItems(); 
				$this->Items = self::getItemsArray();
			}
			
			if($_REQUEST['empty_cart'] == 1)
			{ self::clearCart(); }
			
			if($_REQUEST['cart_item'])
			{ 
				self::editCart(); 
				$this->Items = self::getItemsArray();
			}
			if($_POST['dci'])
			{ 
				self::remItem($_POST['dci']); 
				$this->Items = self::getItemsArray();
			}
		}
		else
		{ self::clearCartCron(); }
	}
	public function getCartItemsCount() { return intval($this->CartItemsCount); }
	public function getSaleStartHour() { return intval($this->SaleStartHour); }
	public function getSaleEndHour() { return intval($this->SaleEndHour); }
	
	public function getAllItemsPrice($round = 0)
	{
		if($round > 0)
		{ return round($this->AllItemsPrice, $round); }
		else
		{ return $this->AllItemsPrice; }
	}
	
	public function getAllItemsVat($round = 0)
	{
		if($round > 0)
		{ return round($this->AllItemsVat, $round); }
		else
		{ return $this->AllItemsVat; }
	}
	
	public function getAllItemsTotal($round = 0)
	{
		if($round > 0)
		{ return round($this->AllItemsTotal, $round); }
		else
		{ return $this->AllItemsTotal; }
	}
	public function getDisplayDialog() { return intval($this->DisplayDialog); }
	
	public function SetVat($val) { $this->Vat = $val; }
	
	public function SetUserID($userid=0)
	{
		if($userid > 0)
		{
			$sql  = 'UPDATE '.DB_PERFIX.'shop_cart_items SET user_id='.intval($userid).' ';
			$sql .= 'WHERE session_id="'.session_id().'";';
			mysql_query($sql); 
		}
	}
	public function setDisplayDialog($val) { $this->DisplayDialog = intval($val); }
	
	function editCart()
	{
		global $shop;
		if($_POST['cart_item'])
		{
			$i=0;
			foreach($_POST['cart_item'] as $id)
			{
				if(($id > 0) && (is_numeric($_POST['ic'][$i])))
				{
					if($this->Items[$id]['items_count'] != $_POST['ic'][$i])
					{
						if($_POST['ic'][$i] == 0)
						{ self::remItem($id); }
						else
						{
							if($_POST['ic'][$i] > 0)
							{
								$sql  = 'UPDATE '.DB_PERFIX.'shop_cart_items SET items_count='.intval($_POST['ic'][$i]).' ';
								$sql .= 'WHERE id='.intval($id).';';
								mysql_query($sql); 
								$this->Items[$id]['items_count'] = $_POST['ic'][$i];
							}
						}
						
						if($shop->getSiteId() == 20)
						{ self::bhCheckPant(); }
					}
				}
				$i++;
			}
		}
	}
	
	function setItems()
	{
		unset($this->Items);
		unset($this->CartItems);
		unset($this->CartItemsCount);
		$this->Items = self::getItemsArray(); 
	}
	
	function getItemsArray($user='', $product = 0, $variation = 0)
	{
		global $user;
		global $shop;
		if(is_object($user))
		{
			if((session_id() != '') || ($user->getId() > 0))
			{
				global $db;
				
				if($user->getId() > 0)
				{ $where = 'ci.user_id='.$user->getId(); }
				else
				{ $where = 'ci.session_id="'.session_id().'" '; }
				
				if($product > 0)
				{ $where .= ' AND ci.product_id='.$product; }
				if($variation > 0)
				{ $where .= ' AND ci.variation_id='.$variation; }
				
				/*
				$sql  = 'SELECT ci.id AS ciId, ci.session_id, ci.user_id, ci.product_id, ci.variation_id, ci.product_cat_id, ci.items_count, ci.item_text, ci.item_image ci.date_created, ';
				$sql .= 'p.id AS pId, p.*, pv.*, st.tax AS tax_value ';
				$sql .= 'FROM '.DB_PERFIX.'shop_cart_items ci, '.DB_PERFIX.'product_vars pv, '.DB_PERFIX.'product p, '.DB_PERFIX.'shop_tax st ';
				$sql .= 'WHERE '.$where.' AND ci.variation_id=pv.id AND ci.product_id=pv.product_id AND ci.product_id=p.id AND p.tax_id=st.id;';
				*/
				$sql  = 'SELECT ci.*, ';
				$sql .= 'p.section_id, p.cat_id, p.group_id, p.tax_id, p.title, p.intro, p.price, p.stock_unit, p.weight_unit, p.dim_unit, p.SaleStartHour, p.SaleEndHour, p.active, ';
				$sql .= 'pv.var_title, pv.identity, pv.ext_identity, pv.std_price, pv.now_price, pv.NowPriceDateEnd, pv.offer_price, pv.offer_start, pv.offer_end, pv.net_weight, pv.gros_weight, pv.length, pv.width, pv.height, ';		
				$sql .= 'st.tax AS tax_value ';
				$sql .= 'FROM '.DB_PERFIX.'shop_cart_items ci, '.DB_PERFIX.'product_vars pv, '.DB_PERFIX.'product p, '.DB_PERFIX.'shop_tax st ';
				$sql .= 'WHERE '.$where.' AND ci.variation_id=pv.id AND ci.product_id=pv.product_id AND ci.product_id=p.id AND (p.tax_id=st.id OR p.tax_id=0);';
				
				$result = $db->query($sql);
				$data = $db->fetch($sql, 0);
				
				if(is_array($data))
				{
					$this->AllItemsPrice = 0;
					$this->AllItemsVat = 0;
					$this->AllItemsTotal = 0;
					$this->CartItemsCount = 0;
					
					foreach($data as $row)
					{
						foreach(array_keys($row) as $key)
						{ $item[$row['id']][$key] = $row[$key]; }
						
						if(($row['length'] > 0) && ($row['width'] > 0) && ($row['height'] > 0))
						{ 
							$item[$row['id']]['volume'] = ($row['length']*$row['width']*$row['height']); 
							if($row['items_count'] > 1)
							{ $item[$row['id']]['volume'] = $item[$row['id']]['volume']*$row['items_count']; }
						}
						else
						{ $item[$row['id']]['volume']=0; }
						
						if(($row['net_weight'] > 0) && ($row['items_count'] > 1))
						{ $item[$row['id']]['net_weight'] = $item[$row['id']]['net_weight']*$row['items_count']; }
						if(($row['net_weight'] > 0) && ($row['items_count'] > 1))
						{ $item[$row['id']]['gros_weight'] = $item[$row['id']]['gros_weight']*$row['items_count']; }
						
						if($item[$row['id']]['net_weight'] > 0)
						{ $this->cartNetWeight += $item[$row['id']]['net_weight']; }
						
						if($item[$row['id']]['gros_weight'] > 0)
						{ $this->cartGrosWeight += $item[$row['id']]['gros_weight']; }
						
						if($item[$row['id']]['volume'] > 0)
						{ $this->cartVolume += $item[$row['id']]['volume']; }
						
						if(session_id() != $item[$row['id']]['session_id'])
						{
							$update = 'UPDATE '.DB_PERFIX.'shop_cart_items SET session_id="'.session_id().'" WHERE id='.$row['id'].';';
							mysql_query($update);
						}
						
						$this->CartItems[$row['id']] = new OrderItem;
						$this->CartItems[$row['id']]->setId($row['id']);
						$this->CartItems[$row['id']]->setProductId($row['product_id']);
						$this->CartItems[$row['id']]->setVariationId($row['variation_id']);
						$this->CartItems[$row['id']]->setCatId($row['product_cat_id']);
						$this->CartItems[$row['id']]->setTaxValue($row['tax_value']);
						$this->CartItems[$row['id']]->setCount($row['items_count']);
						$this->CartItems[$row['id']]->setItemTitle($row['title']);
						$this->CartItems[$row['id']]->setItemVarTitle($row['var_title']);
						$this->CartItems[$row['id']]->setItemIdentity($row['identity']);
						$this->CartItems[$row['id']]->setItemExtIdentity($row['ext_identity']);
						
						$this->CartItems[$row['id']]->setSingleItemPrice($row['std_price']);
						if($shop->getSetting('now_price'))
						{
							unset($nowPriceEnd);
							unset($stdPrice);
							unset($nowPrice);
							$nowPriceEnd = $row['NowPriceDateEnd'];
							if(strtotime($nowPriceEnd) > time())
							{
								if($shop->getSetting('NowPriceIncTax'))
								{
									if(intval($row['std_price']) >= intval(($row['now_price']/$row['tax_value'])))
									{ 
										$this->CartItems[$row['id']]->setSingleItemPrice(($row['now_price']/$row['tax_value']));
										$item[$row['id']]['std_price'] = ($row['now_price']/$row['tax_value']);
									}
								}
								else
								{
									if(intval($row['std_price']) >= intval($row['now_price']))
									{ 
										$this->CartItems[$row['id']]->setSingleItemPrice($row['now_price']);
										$item[$row['id']]['std_price'] = $row['now_price'];
									}
								}
							}
						}
						$this->CartItems[$row['id']]->setSingleItemVolume($row['volume']);
						$this->CartItems[$row['id']]->setSingleItemNetWeight($row['net_weight']);
						$this->CartItems[$row['id']]->setSingleItemGrosWeight($row['gros_weight']);
						$this->CartItems[$row['id']]->setItemText($row['item_text']);
						$this->CartItems[$row['id']]->setItemImage($row['item_image']);
						$this->CartItems[$row['id']]->setItemDimUnit($this->cartDimUnit);
						$this->CartItems[$row['id']]->setItemWeightUnit($this->cartWeightUnit);
						
						if($row['SaleStartHour'] > self::getSaleStartHour())
						{ self::setSaleStartHour($row['SaleStartHour']); }
						
						if($row['SaleEndHour'] > 0)
						{ 
							if(self::getSaleEndHour() == 0)
							{ self::setSaleEndHour($row['SaleEndHour']); }
							else
							{
								if(self::getSaleEndHour() > $row['SaleEndHour'])
								{ self::setSaleEndHour($row['SaleEndHour']); }
							}
						}
						
						$this->CartItems[$row['id']]->setSaleEndHour($row['SaleEndHour']);
						$this->CartItems[$row['id']]->calcTotalValues();
						
						$this->CartItemsCount = $this->CartItemsCount + $this->CartItems[$row['id']]->getCount();
						$this->AllItemsPrice = $this->AllItemsPrice + $this->CartItems[$row['id']]->getTotalItemPrice();
						$this->AllItemsVat = $this->AllItemsVat + $this->CartItems[$row['id']]->getTotalItemTax();
						$this->AllItemsTotal = $this->AllItemsTotal + $this->CartItems[$row['id']]->getTotalItemPriceTotal();
					}
					//print_r($item);
					return $item;
				}
			}
		}
	}
	
	function remItem($id=0)
	{
		global $shop;
		global $user;
		if($id > 0)
		{
			$sql = 'DELETE FROM '.DB_PERFIX.'shop_cart_items WHERE id='.$id.';';
			mysql_query($sql); 
			if(is_object($this->CartItems[$id]))
			{
				if($this->CartItems[$id]->getItemImage() != '')
				{
					if(is_file(CART_PATH.'thumbs/'.$this->CartItems[$id]->getItemImage()))
					{ unlink(CART_PATH.'thumbs/'.$this->CartItems[$id]->getItemImage()); }
					if(is_file(CART_PATH.$this->CartItems[$id]->getItemImage()))
					{ unlink(CART_PATH.$this->CartItems[$id]->getItemImage()); }
				}
				
				if(($shop->getSiteId() == 20) && ($this->CartItems[$id]->getCatId() == 4))
				{ self::bhCheckPant(); }
			}
			self::setItems();
		}
	}
	
	function clearCart()
	{
		global $user;
		if((session_id() != '') || ($user->getId() > 0))
		{
			if($user->getId() > 0)
			{ $where = 'user_id='.$user->getId(); }
			else
			{ $where = 'session_id="'.session_id().'" '; }
			if($where != '')
			{
				$sql = 'DELETE FROM '.DB_PERFIX.'shop_cart_items WHERE '.$where.';';
				mysql_query($sql); 
				
				$sql = 'DELETE FROM '.DB_PERFIX.'shop_cart_items WHERE `date_created` < '.date('Y-m-d 00:00:00').';';
				mysql_query($sql); 
				self::setItems();
			}
		}
	}
	
	function clearCartCron()
	{
		$sql = 'DELETE FROM '.DB_PERFIX.'shop_cart_items WHERE `date_created` < "'.date('Y-m-d 00:00:00').'";';
		mysql_query($sql);
	}
	
	function addItems($pId=0, $vId=0, $count=0)
	{
		$sql 		= '';
		if(intval($_REQUEST['product']) > 0)
		{ $pId = intval($_REQUEST['product']); }
		if(intval($_REQUEST['variation']) > 0)
		{ $vId = intval($_REQUEST['variation']); }
		if(intval($_REQUEST['items_count']) > 0)
		{ $count = intval($_REQUEST['items_count']); }
		$uploadtxt 	= '';
		
		$filenameExt = '';
		$oldFilename = '';
		$newFilename = '';
		$uploadedImage['thumb_name'] = '';
		
		global $shop;
		global $txt;
		global $user;
		
		if(($pId > 0) && ($vId > 0) && ($count > 0) && (($shop->getSiteId() != 20) || ($pId != 31)))
		{
			if(count($shop->CurrentProduct->getAttributesVar()) > 0) //If attributes then each item as separate
			{
				foreach($shop->CurrentProduct->getAttributes() as $att)
				if($att['val_types'] == 5)
				{
					if($att['type'] == 3) //Image Upload
					{ 
						if(is_file(CART_UPLOAD_PATH.'thumbs/'.$user->getSessionId().'_'.$pId.'.jpg'))
						{ $filenameExt = '.jpg'; }
						if(is_file(CART_UPLOAD_PATH.'thumbs/'.$user->getSessionId().'_'.$pId.'.png'))
						{ $filenameExt = '.png'; }
						if(is_file(CART_UPLOAD_PATH.'thumbs/'.$user->getSessionId().'_'.$pId.'.gif'))
						{ $filenameExt = '.gif'; }
						
						if($filenameExt != '')
						{ $oldFilename = $user->getSessionId().'_'.$pId.$filenameExt; }
					}
					if($att['type'] == 4) //Text Upload
					{ 
						if($_REQUEST['attribute_'.$att['id'].'_value_cart'] != '')
						{ $uploadtxt = $_REQUEST['attribute_'.$att['id'].'_value_cart']; }
					}
				}
			}
			else
			{
				if(count($this->Items) > 0)
				{
					foreach($this->Items as $item)
					{
						if(($item['product_id'] == $pId) && ($item['variation_id'] == $vId))
						{ 
							if(($row['item_image'] != '') || ($row['item_text'] != ''))
							{ $sql  = ''; }
							else
							{ $sql  = ' UPDATE '.DB_PERFIX.'shop_cart_items SET items_count=items_count+'.$count.' WHERE id='.$item['id'].';';  }
						}
					}
				}
			}
			
			if($sql == '')
			{
				$sql  = 'INSERT INTO '.DB_PERFIX.'shop_cart_items (`session_id`, ';
				if($user->getId() > 0)
				{ $sql .= '`user_id`, '; }
				if($uploadtxt != '')
				{ $sql .= '`item_text`, '; }
				if($oldFilename != '')
				{ $sql .= '`item_image`, '; }
				if(($shop->getSiteId() == 20) && ($shop->CurrentProduct->getCatId() == 4))
				{ $sql .= '`product_cat_id`, '; }
				$sql .= '`GroupId`, ';
				$sql .= '`product_id`, `variation_id`, `items_count`) ';
				
				$sql .= 'VALUES ("'.$user->getSessionId().'", ';
				if($user->getId() > 0)
				{ $sql .= $user->getId().', '; }
				if($uploadtxt != '')
				{ $sql .= '"'.self::formatText($uploadtxt).'", '; }
				if($oldFilename != '')
				{ $sql .= '"'.$oldFilename.'", '; }
				
				if(($shop->getSiteId() == 20) && ($shop->CurrentProduct->getCatId() == 4))
				{ $sql .= $shop->CurrentProduct->getCatId().', '; }
				$sql .= $shop->CurrentProduct->getGroupId().', ';
				$sql .= intval($pId).', '.intval($vId).', '.intval($count).');';
			}
		}
		if($sql != '')
		{ 
			mysql_query($sql);
			if(($shop->getSiteId() == 20) && ($shop->CurrentProduct->getCatId() == 4))
			{
				$sql  = '';
				if(count($this->Items) > 0)
				{
					foreach($this->Items as $item)
					{
						if(($_REQUEST['attribute_9_value'] == 40) || ($_REQUEST['attribute_16_value'] == 67))
						{
							if(($item['product_id'] == 31) && ($item['variation_id'] == 49132))
							{ $sql  = ' UPDATE '.DB_PERFIX.'shop_cart_items SET items_count=items_count+'.$count.' WHERE id='.$item['id'].';'; }
						}
						else
						{
							if(($item['product_id'] == 32) && ($item['variation_id'] == 61243))
							{ $sql  = ' UPDATE '.DB_PERFIX.'shop_cart_items SET items_count=items_count+'.$count.' WHERE id='.$item['id'].';'; }
						}
					}
				}
				
				if($sql == '')
				{
					$sql  = 'INSERT INTO '.DB_PERFIX.'shop_cart_items (`session_id`, ';
					if($user->getId() > 0)
					{ $sql .= '`user_id`, '; }
					$sql .= '`product_id`, `variation_id`, `items_count`) ';
					
					$sql .= 'VALUES ("'.$user->getSessionId().'", ';
					if($user->getId() > 0)
					{ $sql .= $user->getId().', '; }
					
					if(($_REQUEST['attribute_9_value'] == 40) || ($_REQUEST['attribute_16_value'] == 67))
					{ $sql .= '31, 49132, '.intval($count).');'; }
					else
					{ $sql .= '32, 61243, '.intval($count).');'; }
				}
				if($sql != '')
				{ mysql_query($sql); }
			}
			
			if(($oldFilename != '') && ($filenameExt != ''))
			{
				if(is_file(CART_UPLOAD_PATH.$oldFilename))
				{
					$select = 'SELECT id FROM '.DB_PERFIX.'shop_cart_items WHERE `session_id`="'.$user->getSessionId().'" AND `product_id`='.$pId.' ORDER BY id DESC LIMIT 1;';
					$result = mysql_query($select);
					if(mysql_num_rows($result) > 0)
					{
						while($row = mysql_fetch_array($result))
						{ $cartItemID = intval($row['id']); }
					}
					if($cartItemID > 0)
					{
						$newFilename = $cartItemID.'_'.$pId.'_'.$vId.$filenameExt; 
						
						$imageClass = new Image();
						$imageClass->moveRenameImageWithThumbs(CART_UPLOAD_PATH, CART_PATH, $oldFilename, $newFilename, 'CART');
						
						$sql = 'UPDATE '.DB_PERFIX.'shop_cart_items SET `item_image`="'.$newFilename.'" WHERE `id`='.$cartItemID.';';
						$result = mysql_query($sql);
					}
				}
			}
			self::setItems();
			if(($shop->getSiteId() == 20) && ($shop->CurrentProduct->getCatId() == 4))
			{ self::bhCheckPant(); }
			if($shop->getGlobalSetting('show_cart_on_add'))
			{ header('Location: '.SITE_URL.'?c=15'); }
			if($shop->getGlobalSetting('dialog_cart_on_add'))
			{ self::setDisplayDialog(1); }
		}
	}
	
	function uploadCartImage($file, $pid=0)
	{
		global $shop;
		global $user;
		$error = '';
		
		if((is_object($shop->CurrentProduct)) && ($pid > 0))
		{
			$imageClass = new Image();
			global $thumb;
			
			if($imageClass->image_valid($file['type']) && ($file['name'] != ""))
			{
				$type = $file['type'];
				$tempName = $file["name"];
				$fnameParts = array_reverse(explode(".",$tempName));
				$extension = str_ireplace("jpeg","jpg",strtolower($fnameParts[0]));
				//$extension = strtolower(substr($tempName,-3));
				
				$newName = $user->getSessionId().'_'.$pid;
				$newFilename = $newName.'.'.$extension;
				
				$new_name = $newName.'.'.$extension;
				//echo '<br />$new_name:'.$new_name;
				
				move_uploaded_file($file["tmp_name"], CART_UPLOAD_PATH.$newFilename);

				list($width, $height) = getimagesize(CART_UPLOAD_PATH.$newFilename);

				if(($width > $thumb['CART'][0]['MAXW']) || ($height > $thumb['CART'][0]['MAXH']))
				{ $imageClass->resizePhoto(CART_UPLOAD_PATH.$newFilename, $type, $thumb['CART'][0]['MAXW'], $thumb['CART'][0]['MAXH']); }

				$i=0;
				$j=0;
				
				foreach($thumb['CART'] as $thumb)
				{
					if($j > 0)
					{
						$thumbName = $newFilename;
						if($i > 0)
						{ $thumbName = $thumb['MAXW'].'_'.$newFilename; }
						
						if(is_file(CART_UPLOAD_PATH.$newFilename))
						{
							if(copy(CART_UPLOAD_PATH.$newFilename, CART_UPLOAD_PATH.'thumbs/'.$thumbName)) 
							{ $imageClass->resizePhoto(CART_UPLOAD_PATH.'thumbs/'.$thumbName, $type, $thumb['MAXW'], $thumb['MAXH']); }
						}
						$i++;
					}
					$j++;
				}
				
				if(is_file(CART_UPLOAD_PATH.$newFilename))
				{ self::setCartImage($newFilename); }
				else
				{ $error = ucfirst($txt->getWord('invalid').' '.$txt->getWord('file')); }
			}
			else
			{ $error = ucfirst($txt->getWord('invalid').' '.$txt->getWord('file')); }
		}
		return $error;
	}
	
	
	function bhCheckPant()
	{
		global $user;
		
		if($user->Id > 0)
		{ $where = 'user_id='.$user->getId(); }
		else
		{ $where = 'session_id="'.session_id().'"'; }
		
		$catPantProducts = 0;
		$catPants = 0;
		
		$sql = 'SELECT * FROM '.DB_PERFIX.'shop_cart_items WHERE '.$where.';';
		$result = mysql_query($sql); 
		//echo '<br />$sql:'.$sql;
		if(mysql_num_rows($result) > 0)
		{
			while($row = mysql_fetch_array($result))
			{
				if(($row['product_cat_id'] == 4) && ($row['product_id'] != 31) && ($row['product_id'] != 32))
				{ $catPantProducts = $catPantProducts + $row['items_count']; }
				if($row['product_id'] == 31)
				{ $catPants = $catPants + $row['items_count']; }
				if($row['product_id'] == 32)
				{ $catPants = $catPants + $row['items_count']; }
			}
		}
		
		//echo '<br />$catPantProducts:'.$catPantProducts;
		//echo '<br />$catPants:'.$catPants;
		
		if($catPantProducts != $catPants)
		{
			$sql = 'DELETE FROM '.DB_PERFIX.'shop_cart_items WHERE '.$where.' AND product_id=31;';
			mysql_query($sql);
			//echo '<br />$sql:'.$sql;
			
			if($catPantProducts > 0)
			{
				$sql  = 'INSERT INTO '.DB_PERFIX.'shop_cart_items (`session_id`, ';
				if($user->getId() > 0)
				{ $sql .= '`user_id`, '; }
				$sql .= '`product_id`, `variation_id`, `items_count`) ';
				
				$sql .= 'VALUES ("'.$user->getSessionId().'", ';
				if($user->getId() > 0)
				{ $sql .= $user->getId().', '; }
				$sql .= '31, 49132, '.intval($catPantProducts).');';
				
				mysql_query($sql);
				//echo '<br />$sql:'.$sql;
			}
		}
		return;
	}
}

?>